package proyectoia;

import aima.search.framework.GoalTest;
import aima.search.framework.HeuristicFunction;
import aima.search.framework.Search;
import aima.search.framework.SuccessorFunction;
import aima.search.informed.SimulatedAnnealingSearch;
import java.util.logging.Level;
import java.util.logging.Logger;

public class StagedExperiment4 extends StagedExperiment {

    SuccessorFunction successor;
    Integer initial;
    SimulatedAnnealingSearch search;

    public StagedExperiment4(int seed, int nIterations) {
        super(seed, nIterations);
        numStages = 1;
    }

    @Override
    protected int getNumUsers() {
        return 200;
    }

    @Override
    protected int getNumRequests() {
        return 5;
    }

    @Override
    protected int getNumServers() {
        return 50;
    }

    @Override
    protected int getNumReplications() {
        return 5;
    }

    @Override
    protected DistFileSystemState getInitialSolution(DistFileSystemState state) {
        switch (initial) {
            case GREEDY:
                state.generateGreedySolution();
                break;
            case RANDOM:
                state.generateRandomSolution(seed);
                break;
            case EMPTY:
                state.generateEmptySolution();
                break;
        }
        return state;
    }

    @Override
    protected Search getSearch() {
        return search;
    }

    @Override
    protected Integer getSearchResult() {
        return STATES;
    }
    
    @Override
    protected SuccessorFunction getSuccessor() {
        return successor;
    }

    @Override
    protected GoalTest getGoalTest() {
        return new DistFileSystemGoalTest();
    }

    @Override
    protected HeuristicFunction getHeuristic() {
        return new DistFileSystemHeuristicFunction1();
    }
    
    public static void main(String[] args) {
        StagedExperiment se3 = new StagedExperiment4(123, 1);
        try {
            se3.initialitze();
            se3.execute();
            se3.printSlowestServerTime("experiment-4");
        } catch (Exception e) {
            Logger.getLogger(DistFileSystem.class.getName()).log(Level.SEVERE, null, e);
        }
    }
}